package com.huoyun.tag;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.UIBean;
import com.opensymphony.xwork2.util.ValueStack;

public class PageBean extends UIBean {

	protected String totalRecord;
	protected String totalPage;
	protected String pageNo;
	protected String url;
	protected boolean isAjax = false;
	protected String ajaxDiv = "div";
	protected String style;

	public String getTotalRecord() {
		return totalRecord;
	}

	public void setTotalRecord(String totalRecord) {
		this.totalRecord = totalRecord;
	}

	public String getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(String totalPage) {
		this.totalPage = totalPage;
	}

	public String getPageNo() {
		return pageNo;
	}

	public void setPageNo(String pageNo) {
		this.pageNo = pageNo;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getStyle() {
		return style;
	}

	public void setStyle(String style) {
		this.style = style;
	}

	public PageBean(ValueStack stack, HttpServletRequest request,
			HttpServletResponse response) {
		super(stack, request, response);
	}

	@Override
	protected String getDefaultTemplate() {
		return "page"; //+ style.toLowerCase();
	}

	@Override
	protected void evaluateExtraParams() {
		super.evaluateExtraParams();
		addParameter("totalRecord", findString(totalRecord));
		addParameter("totalPage", findString(totalPage));
		addParameter("pageNo", findString(pageNo));
		addParameter("url", findString(url));
		addParameter("isAjax", isAjax);
		addParameter("ajax", findString(ajaxDiv));
		addParameter("style", style);
	}

	public boolean getIsAjax() {
		return isAjax;
	}

	public void setIsAjax(boolean isAjax) {
		this.isAjax = isAjax;
	}

	public String getAjaxDiv() {
		return ajaxDiv;
	}

	public void setAjaxDiv(String ajaxDiv) {
		this.ajaxDiv = ajaxDiv;
	}

}
